package com.elves.auth;

/**
 * Dog 类通过 extends 关键字继承了 Animal 类，而 Bird 类通过 implements 关键字实现了 Flyable 接口。
 * <p>
 * 总结来说，extends 用于类的继承，允许一个类继承另一个类的属性和方法，而 implements 用于接口的实现，允许一个类实现一个或多个接口中定义的方法。
 */
// 继承
class Animal {
    void eat() {
        System.out.println(this.getClass() + " Eating");
    }

    public static void main(String[] args) {
        System.out.println("Animal");
        Animal dog = new Dog();
        dog.eat();
        ((Dog) dog).bark();

        ((Dog) dog).show();
        ((Run) dog).run();
        System.out.println("----------");

        Animal bird = new Bird();
        bird.eat();
        ((Bird) bird).fly();

        Animal bee = new Bee();
        bee.eat();
        ((Chong) bee).fly();
        ((Chong) bee).sleep();
    }
}

class Dog extends Animal implements Run {
    void bark() {
        System.out.println("Dog Barking");
    }

    @Override
    public void run() {
        System.out.println("the dog runing");
    }
}

// 实现接口
interface Flyable {
    void fly();
}

class Bird extends Animal implements Flyable {
    public void fly() {
        System.out.println("can Flying");
    }
}

abstract class Chong extends Animal implements Flyable {
    void eat() {
        System.out.println(this.getClass() + " Eating:: " + "me me");
    }

    abstract void sleep();
}

class Bee extends Chong {
    void eat() {
        System.out.println(this.getClass() + " Eating:: " + "me a me");
    }

    @Override
    void sleep() {
        System.out.println("wu wu wu");
    }

    @Override
    public void fly() {
        System.out.println("wen wen ");
    }


    public void gogo() {
        String str = """
                gogo
                """;
    }

}